/*	COMP 6761 Assignment 1 Framework
	Created by Kaustubha Mendhurwar on 09/09/14.
	Copyright (c) 2014 Concordia University. All rights reserved.
*/

#pragma once
#include <iostream>
#include <exception>
#include "Renderer.h"
#include "World.h"
#include "EventManager.h"

int main(int argc, char*argv[])
{
	try
	{
		std::cout << std::endl;
		std::cout << "Instructions:" << std::endl;
		std::cout << " + on the keypad zooms in " << std::endl;
		std::cout << " - on the keypad zooms out" << std::endl;
		std::cout << " w increases the Inner tesselation level" << std::endl;
		std::cout << " s decreases the Inner tesselation level" << std::endl;
		std::cout << " e increases the Outer tesselation level" << std::endl;
		std::cout << " d decreases the Outer tesselation level" << std::endl;
		std::cout << " SPACE resets all tesselations level" << std::endl;
		std::cout << std::endl;

		EventManager::Initialize();
		Renderer::Initialize();

		World world;




		do
		{
			// Update Event Manager - Frame time / input / events processing 
			EventManager::Update();

			// Update World
			float dt = EventManager::GetFrameTime();
			world.Update(dt);

			// Draw World
			world.Draw();
		} while (EventManager::ExitRequested() == false);

		Renderer::Shutdown();
		EventManager::Shutdown();

	}
	catch (std::exception const & e)
	{
		std::cerr << "Exception was thrown:" << std::endl << e.what() << std::endl;
		return 1;
	}

	return 0;
}
